﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using DNA.UI;

/// <summary>
/// Summary description for DemoPage
/// </summary>
public class DemoPage:Page
{
    protected override void OnPreInit(EventArgs e)
    {
        if (Page.IsPostBack)
        {
            string theme = Context.Request.Form["selectedTheme"];
            Theme = theme;
        }
        else
        {
            if (string.IsNullOrEmpty(this.Theme))
                this.Theme = "ui-darkness";
        }
        base.OnPreInit(e);
    }

    protected override void OnInit(EventArgs e)
    {
        string[] styleSheets = Directory.GetFiles(Context.Server.MapPath("~/CommonStyle/"), "*.css");
        foreach (string name in styleSheets)
        {
            FileInfo fi=new FileInfo(name);
            string href = ResolveUrl("~/CommonStyle/" + fi.Name);
            Header.Controls.Add(DNA.UI.ClientScriptManager.CreateStyleLink(href));
        }
        base.OnInit(e);
    }
}
